package com.just.bz_back.controller.admin;

import com.just.bz_back.model.RepairAdminDescription;
import com.just.bz_back.model.RepairUserDescription;
import com.just.bz_back.model.dto.JsonData;
import com.just.bz_back.service.DescriptionService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : baibaiwucahng
 * @date : 2019/9/6  22:14
 */
@RestController
@RequestMapping("/api/v1/admin/description")
public class DescriptionController {
    @Resource
    private DescriptionService descriptionService;

    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public JsonData DescriptionList(@RequestBody RepairUserDescription repairUserDescription)
    {

        return JsonData.buildSuccess(descriptionService.getDescriptionList(repairUserDescription));
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public JsonData updateDecription(@RequestBody RepairUserDescription repairUserDescription)
    {
        return JsonData.buildSuccess(descriptionService.updateDecription(repairUserDescription));
    }

    @RequestMapping(value = "/insertadmin",method = RequestMethod.POST)
    public JsonData insertAdmin(@RequestBody  RepairAdminDescription repairAdminDescription)
    {
        return JsonData.buildSuccess(descriptionService.insertAdmin(repairAdminDescription));
    }

    @RequestMapping(value = "/insertuser",method = RequestMethod.POST)
    public JsonData insertUser (@RequestBody  RepairUserDescription repairUserDescription)
    {
        return JsonData.buildSuccess(descriptionService.insertUser(repairUserDescription));
    }

    @RequestMapping(value = "/listadmin",method = RequestMethod.POST)
    public JsonData listadmin (@RequestBody  RepairAdminDescription repairAdminDescription)
    {
        return JsonData.buildSuccess(descriptionService.listAdmin(repairAdminDescription));
    }

    @RequestMapping(value = "/updateadmin",method = RequestMethod.POST)
    public JsonData updateadmin(@RequestBody RepairAdminDescription repairAdminDescription)
    {
        return JsonData.buildSuccess(descriptionService.updateAdmin(repairAdminDescription));
    }




}
